<style>
    .form-copy {
        margin-right: 5px;
        border-radius: 0;
        box-shadow: none;
        padding: 4px 12px 7px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        border: 1px solid #ccc;
        transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
    }
    .select2 {
        margin-right: 5px
    }
</style>
@if(\Encore\Admin\Facades\Admin::user()->can('os-ba.box-in.trans'))
    {{-- 行选操作 start --}}
    <div class="btn-group">
        <a class="btn btn-sm btn-default">  {{ trans('admin.action') }}</a>
        <button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown">
            <span class="caret"></span>
            <span class="sr-only">Toggle Dropdown</span>
        </button>
        <ul class="dropdown-menu" role="menu">
            <li><a href="#" class="grid-batch">更换标签</a></li>
            <li><a href="#" class="split-box">拆箱</a></li>
        </ul>
    </div>
    {{-- 行选操作 end --}}
@endif
<div class="btn-group" style="margin-right: 10px">
    <form action="{{ $action }}" pjax-container method="get">
        <input type="text" class="form-copy" style=" width:120px;" name="batch_no" value="{{ $filtersBlade['batch_no'] }}" placeholder="批次号">
        <select id="account_id" name="account_id">
            {{ $filtersBlade['account_id'] }}
        </select>
        <select id="area_id" name="area_id">
            {{ $filtersBlade['area_id'] }}
        </select>
        <select id="country_id" name="country_id">
            {{ $filtersBlade['country_id'] }}
        </select>
        <select id="warehouse_id" name="warehouse_id">
            {{ $filtersBlade['warehouse_id'] }}
        </select>
        <select id="classify_id" name="classify_id">
            {{ $filtersBlade['classify_id'] }}
        </select>
        <input type="text" class="form-copy" style=" width:120px;" name="fnsku" value="{{ $filtersBlade['fnsku'] }}" placeholder="FNSKU">
        <input type="text" class="form-copy" style=" width:120px;" name="sku" value="{{ $filtersBlade['sku'] }}" placeholder="SKU">
        <input type="text" class="form-copy" style=" width:120px;" name="tracking_no" value="{{ $filtersBlade['tracking_no'] }}" placeholder="追踪号">
        <button class="btn btn-sm btn-info submit"><i class="fa fa-search"></i>&nbsp;&nbsp;{{ trans('admin.search') }}</button>
        <a style="margin-left: 10px;" href="{{ $action }}" class="btn btn-sm btn-default"><i class="fa fa-undo"></i>&nbsp;&nbsp;{{ trans('admin.reset') }}</a>
    </form>
</div>
<script language="JavaScript" type="text/javascript">
    $(function () {
        $('#account_id').select2({placeholder: '账号', allowClear: true, width: '150px'});
        $('#area_id').select2({placeholder: '站点', allowClear: true, width: '150px'});
        $('#country_id').select2({placeholder: '国家', allowClear: true, width: '150px'});
        $('#warehouse_id').select2({placeholder: '仓库', allowClear: true, width: '150px'});
        $('#classify_id').select2({placeholder: '品类', allowClear: true, width: '150px'});

        var selectedRows = function () {
            var selected = [];
            $('.grid-row-checkbox:checked').each(function(){
                selected.push($(this).data('id'));
            });
            return selected;
        };

        $('.grid-batch').on('click', function() {
            var ids = selectedRows();
            if(ids.length == 0){
                swal('请选择更换标签单据', '', 'error');
                return ;
            }
            location.href = '/xqc/overseas-ba/box-in-trans?id=' + ids.join(',');
        });

        //拆箱
        $('.split-box').on('click', function() {
            let ids = selectedRows();
            if(ids.length == 0){
                swal('请选择拆箱单据', '', 'error');
                return ;
            }
            location.href = '/xqc/overseas-ba/box-in-split?id=' + ids.join(',');
        });
    });
</script>
